Skip to content

DOC: Improve docstring of Index.delete #32015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Feb 15, 2020
Merged

DOC: Improve docstring of Index.delete #32015

merged 15 commits into from
Feb 15, 2020

Conversation

andhikayusup
Copy link
Contributor

@andhikayusup andhikayusup commented Feb 15, 2020

Output from validate_docstrings.py
################################################################################
####################### Docstring (pandas.Index.delete) #######################
################################################################################

Make new Index with passed location(-s) deleted.

Use array of integer as loc parameter to delete multiple locations.

Parameters

loc : int
Location of item(-s) which will be deleted.

Returns

Index
New Index with passed location(-s) deleted.

See Also

numpy.delete : Delete any rows and column from NumPy array (ndarray).

Examples

idx = pd.Index(['a', 'b', 'c'])
idx.delete(1) # Deleting 'b'
Index(['a', 'c'], dtype='object')
idx = pd.Index(['a', 'b', 'c'])
idx.delete([0, 2])
Index(['b'], dtype='object')

################################################################################
################################## Validation ##################################
################################################################################

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just few minor comments

@@ -5135,9 +5135,30 @@ def delete(self, loc):
"""
Make new Index with passed location(-s) deleted.

Use array of integer as loc parameter to delete multiple locations.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain this in the parameter description please


Parameters
----------
loc : int
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int or list of int

Examples
--------
>>> idx = pd.Index(['a', 'b', 'c'])
>>> idx.delete(1) # Deleting 'b'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove the comment, the example is good enough to be clear that we're deleting b

@datapythonista datapythonista changed the title Docfix DOC: Improve docstring of Index.delete Feb 15, 2020
@pep8speaks
Copy link

pep8speaks commented Feb 15, 2020

Hello @andhikayusup! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-02-15 12:19:52 UTC

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment in a sentence that I think could be improved, but looks good to me.

----------
loc : int or list of int
Location of item(-s) which will be deleted.
Use list of integer as loc parameter to delete multiple locations.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about the next?

Use a list of locations to delete more than one value at the same time

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@simonjayhawkins simonjayhawkins added this to the 1.1 milestone Feb 15, 2020
Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@simonjayhawkins simonjayhawkins merged commit 10228cb into pandas-dev:master Feb 15, 2020
@simonjayhawkins
Copy link
Member

Thanks @andhikayusup

@andhikayusup andhikayusup deleted the docfix branch February 24, 2020 15:11
roberthdevries pushed a commit to roberthdevries/pandas that referenced this pull request Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants